#pragma once

#include <mutex>


#include "Misc/CommonMacros.h"
#include "Object.h"
#include "RootObject.m.h"

//RootObject is the root of object tree
//it's child might create in worker thread, so the children is guard by thread lock
RCLASS()
class WHENGINE_API RRootObject : public RObject
{
    ROBJECT

public:
	//just remove child from children list
	virtual void RemoveChildFromChildren(RObject* Child) override;
	//just add child to children list
	virtual void AddChildToChildren(RObject* Child) override;

    virtual void MakeSureChildNameUnique(RObject* Child) override;
    
    virtual RObject* FindChild(const CString& InNodeName) override;  


    RObjectPtr TransientAsset = nullptr;

protected:
    std::mutex ChildrenLock;

};